package com.ghsc.yigou.live.ui

import androidx.lifecycle.MutableLiveData
import com.cn.appcore.base.BaseViewModel
import com.cn.appcore.ext.executeResponse
import com.cn.appcore.http.bean.BaseResponse
import com.ghsc.yigou.live.api.ApiMarket
import com.ghsc.yigou.live.ui.activity.bean.OssTokenResultDataBean
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext

/**
 * 项目：YiGouLive
 * 包名：com.ghsc.yigou.live.ui
 * 类名：MainViewModel
 * 创建时间：2024/8/1 10:38
 * 创建人 @author： xiaolin
 * 描述 ：Todo...
 */
class MainViewModel  : BaseViewModel(){

    /** 阿里云oos **/
    var onAliYunOosData = MutableLiveData<BaseResponse<OssTokenResultDataBean>>()
    fun onAliYunOosMethod(paras:String) {
        launch {
            val response = withContext(Dispatchers.IO) { ApiMarket.service.onAliYunOosData(paras) }
            executeResponse(
                response,
                { onAliYunOosData.value = response},
                { againLoginMsg.value = response.msg}
            ) { errorMsg.value = response.msg }

        }
    }
}